unit CustomMessageBox;

interface

uses Forms, Controls, SysUtils, Classes, Menus, TypInfo, Dialogs;

function ShowMessageMod(self: TComponent; Pytanie, Podp, Ikona, Buttony: string): integer;

implementation

uses msgFrm;

function ShowMessageMod(self: TComponent; Pytanie, Podp, Ikona, Buttony: string): integer;
var
 msgForm: TMsgForm;
begin

 msgForm := TMsgForm.Create(self);
 msgForm.Color := GetPropValue(self, 'Color');
 msgForm.Caption := 'Kulki';
 msgForm.lGlowny.Caption := Pytanie;
 msgForm.lPodpowiedz.Caption := Podp;

  if Ikona = 'warning' then
     begin
     msgForm.iQuestion.Visible := false;
     msgForm.iError.Visible := false;
     msgForm.iInformation.Visible := false;
     msgForm.iWarning.Visible := true;
     end
   else  if Ikona = 'information' then
     begin
     msgForm.iQuestion.Visible := false;
     msgForm.iError.Visible := false;
     msgForm.iInformation.Visible := true;
     msgForm.iWarning.Visible := false;
     end
   else  if Ikona = 'error' then
     begin
     msgForm.iQuestion.Visible := false;
     msgForm.iError.Visible := true;
     msgForm.iInformation.Visible := false;
     msgForm.iWarning.Visible := false;
     end
    else if Ikona = 'question' then
     begin
     msgForm.iQuestion.Visible := true;
     msgForm.iError.Visible := false;
     msgForm.iInformation.Visible := false;
     msgForm.iWarning.Visible := false;
     end;

   if buttony='YesNo' then
      begin
      msgForm.b1.Visible := true;
      msgForm.b2.Visible := true;
      msgForm.b1.Caption := 'Tak';
      msgForm.b2.Caption := 'Nie';
      end
    else  if buttony='OK' then
      begin
      msgForm.b1.Visible := false;
      msgForm.b2.Visible := true;
      msgForm.b2.Caption := 'OK';
      end;

   if msgForm.ShowModal = mrYes then
      begin
       result := 1;
      end
      else
        result := 0; 
   msgForm.Free;
end;

end.
